package com.coocaa.internship.controller;

import com.coocaa.internship.common.ResultData;
import com.coocaa.internship.service.serviceImpl.PositionListServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author :hhd
 * @Description:
 * @date :2019/8/8 9:36
 */

@Controller
@RequestMapping("/positionList")
public class PositionListController {

    @Autowired
    PositionListServiceImpl positionListService;

    @RequestMapping(value = "/selectAll", method = RequestMethod.GET)
    @ResponseBody
    public ResultData selectAllPositionList(@RequestParam(value = "pn", defaultValue = "1") Integer pn) {
        return positionListService.selectAllPositionList(pn);
    }

    @RequestMapping(value = "/selectByPositionName", method = RequestMethod.GET)
    @ResponseBody
    public ResultData selectPositionListByPositionName(@RequestParam("positionName") String positionName,
                                                       @RequestParam(value = "pn", defaultValue = "1") Integer pn) {
        return positionListService.selectPositionListByPositionName(positionName, pn);
    }

    @RequestMapping(value = "/selectByPositionArea", method = RequestMethod.GET)
    @ResponseBody
    public ResultData selectPositionListByPositionArea(@RequestParam("positionArea") String positionArea,
                                                       @RequestParam(value = "pn", defaultValue = "1") Integer pn) {
        return positionListService.selectPositionListByPositionArea(positionArea, pn);
    }

    @RequestMapping(value = "/selectByPositionNameOrCompany", method = RequestMethod.GET)
    @ResponseBody
    public ResultData selectPositionListByPositionNameOrCompany(@RequestParam("positionNameOrCompany") String positionNameOrCompany,
                                                                @RequestParam(value = "pn", defaultValue = "1") Integer pn) {
        return positionListService.selectPositionListByPositionNameOrCompany(positionNameOrCompany, pn);
    }

    @RequestMapping(value = "/selectByPositionType")
    @ResponseBody
    public ResultData selectPositionListByPositionType(@RequestParam("positionType") String positionType,
                                                       @RequestParam(value = "pn", defaultValue = "1") Integer pn) {
        return positionListService.selectPositionListByPositionType(positionType, pn);
    }

}
